# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-getopt-long
_pkgname=Getopt-Long
pkgver=2.58
pkgrel=2
pkgdesc='Extended processing of command line options.'
arch=('any')
url='https://metacpan.org/pod/Getopt::Long'
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl>=0')
source=("http://search.cpan.org/CPAN/authors/id/J/JV/JV/$_pkgname-$pkgver.tar.gz")
sha512sums=('c673b82a819533310d5697be7e0b009ed39fd02873d17b3f0e1eebab790c58faf5e0a6b1d79bf274e3ee9d35d43b355988dccae56ec9fcbc6822bcae7d7e2ef6')

build() {
  cd "$_pkgname-$pkgver"

  (
    export PERL_MM_USE_DEFAULT=1 PERL5LIB="" PERL_AUTOINSTALL=--skipdeps \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
      PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
      MODULEBUILDRC=/dev/null

    /usr/bin/perl Makefile.PL

    make
  )
}

package() {
  cd "$_pkgname-$pkgver"

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

